package com.zxh.util;

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * Created by zhangxh on 2016/7/11.
 */
public class Constant {
    private static final String config="properties/config.properties";
    private static Properties props;
    public static void init(){
        props=new Properties();
        InputStream is=new BufferedInputStream(Constant.class.getClassLoader().getResourceAsStream(config));
        try {
            props.load(is);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public static String getPropertity(String string) {
        return props.getProperty(string, "");
    }

    public static String getPropertity(String string,String dfStr) {
        return props.getProperty(string, dfStr);
    }

    public static int getPropertity(String string,int dfInt) {
        return Integer.valueOf(props.getProperty(string, dfInt+""));
    }
    public static String getXDCookie(){
        return getPropertity("xd.cookie","BDUSS=VZySDVuWjltUzdyZlM4Z0FnRERVQ0lUejRyblFuWFZvbERzTUgxckMzZWRDWmRXQVFBQUFBJCQAAAAAAAAAAAEAAAB1ZkQIMzgyNTY2Njk3AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJ18b1adfG9WL");
    }
    public static String getXDUri(){
        return getPropertity("xd.uri","https://sp0.baidu.com/yLsHczq6KgQFm2e88IuM_a/s?sample_name=bear_brain&");
    }

}
